<!doctype html>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page import="com.cn.ccp.util.Contants"%>
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%
	String path = request.getContextPath();
	String basePath1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	UserBean users = (UserBean) session.getAttribute(Contants.USER_SESSION_BEAN);
%>
<html>
<f:view>
	<f:loadBundle var="messages" basename="messages"></f:loadBundle>
	<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" />
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- styles -->
<link href="<%=request.getContextPath()%>/css/bootstrap.css"
	rel="stylesheet">
<link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css"
	rel="stylesheet">
<link href="<%=request.getContextPath()%>/css/custom.css"
	rel="stylesheet">
<!--[if lt IE 9]>
      <script src="../js/html5.js"></script>
    <![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"
	href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon"
	href="<%=request.getContextPath()%>/images/icon/favicon.png">
<link href="<%=request.getContextPath()%>/css/upload/default.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/upload/swfobject.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/upload/jquery.uploadify.v2.0.1.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/themes/default/default.css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/code/prettify.css" />
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/lang/zh_CN.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/plugins/code/prettify.js"></script>	
<script type="text/javascript" src="<%=request.getContextPath()%>/flexpaper/js/flexpaper_flash.js"></script>	
<style>
.firstColumn {
	width: 12%;
	text-align: center;
}

.secondColumn {
	width: 60%;
	text-align: right;
}

.thirdColumn {
	width: 50px;
	text-align: left;
}

.fourColumn {
	width: 30px;
	text-align: left;
}

.fiveColumn {
	width: 30px;
	text-align: left;
}
</style>

	</head>

	<body class="bg-white" style="overflow-x:hidden;">
	<a id="viewDiv"></a>
		<h:form id="formid">
			<h:inputHidden value="#{courseForumAction.id}"></h:inputHidden>
			<h:inputHidden value="#{courseForumAction.type}"></h:inputHidden>
			<h:inputHidden value="#{courseForumAction.courseId}"></h:inputHidden>
			<div class="row page-head">
				<h3 class="page-title">
					<i class="n-icon-selection  n-icon-black"></i>
					<h:outputText value="#{messages['pages_bbs_title']}" />
					&nbsp;&gt;&nbsp;<b><h:outputText
							value="#{messages['pages_bbs_add_new_bbs']}" />
					</b>
				</h3>
			</div>
			<div style="margin-left: 20px; margin-right: 20px">
				<fieldset>
					<div class="form-white">
						<h4>发布新的帖子</h4><br/>
						<div class="control-group">
							<h:outputText value="标题："></h:outputText>&nbsp;&nbsp;<h:inputText value="#{courseForumAction.bean.title}" style="width:300px"></h:inputText>
						</div>
						<div class="control-group">
							<h:outputText value="所属课程："></h:outputText>&nbsp;&nbsp;
							<h:selectOneMenu value="#{courseForumAction.courseId}" disabled="true">
								<f:selectItems value="#{publicAction.couresSelectItem}"/>
							</h:selectOneMenu>
						</div>
						<div class="control-group">
							<textarea name="content1" id="content1" cols="100" rows="8" style="width:70%;height:20px;visibility:hidden;">
                         		<h:outputText value="#{courseForumAction.bean.contents}"/>
                         		<h:inputHidden id="hiddenContents" value="#{courseForumAction.bean.contents}"></h:inputHidden>
                         	</textarea>
						</div>
						<div class="control-group">
							<a4j:outputPanel ajaxRendered="true" id="outputpanelId">
								<h:messages layout="table" style="color:red"></h:messages>
							</a4j:outputPanel>
						</div>
						<h:commandButton value="发布" styleClass="btn btn-success"
							action="#{courseForumAction.add}" />
						<h:outputText value=" "></h:outputText>
						<h:commandButton value="取消" action="main" styleClass="btn" immediate="true" />
					</div>
				</fieldset>
			</div>
		</h:form>
		<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
		<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
		<script>
		 KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : '<%=basePath1%>/plugins/code/prettify.css',
				uploadJson : '<%=basePath1%>/jsp/upload_json.jsp',
				fileManagerJson : '<%=basePath1%>/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						//document.forms['example'].submit();
						document.getElementById("formid").submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.getElementById("formid").submit();
						//document.forms['example'].submit();
					});
				},
				afterChange : function() {  
		            K('.word_count1').html(this.count());  
		            K('.word_count2').html(this.count('text')); 
		            
		        }  
			});
			 editor1.statusbar.remove(); 
			 prettyPrint();
			
		});
		
		
		</script>
	</body>
</f:view>
</html>
